<template>
  <div class="rule-panel">
    <YEditor ref="yEditor"/>
    <el-input v-model="insetText" placeholder="请输入规则" />
    <el-button @click="insertContent">插入</el-button>
    <el-button @click="showContent">查看内容</el-button>
  </div>
</template>

<script setup lang="ts" name="RulePanel">
import YEditor from '@/components/y-editor/index.vue'
const insetText = ref("")

const yEditor = ref<InstanceType<typeof YEditor> | null>(null)
const insertContent = () => {
  yEditor.value?.insertContent(insetText.value + '\n')
}
const showContent = () => {
  console.log('获取文本内容')
  console.log(JSON.stringify(yEditor.value?.getEditorContent()));
  
}
</script>

<style lang="scss">
.rule-panel {
  /* color: red; */

  .ql-container {
    min-height: 360px;
  }
}
</style>
